package com.astoolkit.workflow.task.pipeline
{
	import avmplus.getQualifiedClassName;
	
	import com.astoolkit.workflow.BasePipelineTask;
	
	public class DrillInPipeline extends BasePipelineTask
	{
		public var chain : String;
		
		override public function begin(inRetain:Boolean=false):void
		{
			var data : Object = _pipelineData;
			for each( var prop : String in chain.split( "." ) )
			{
				if( !data.hasOwnProperty( prop ) )
				{
					fail( getQualifiedClassName( data ) + " has no \"" + prop + "\" property" );
					return;
				}
				data = data[prop];
			}
			
			_pipelineData = data;
			complete();
		}
	}
}